package com.qf.java2207.no3_teamproject_springboot_01.config;
//须知少时凌云志，曾许人间第一流

import org.springframework.web.servlet.config.annotation.CorsRegistry;

import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

public class MyMvConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        // registry  解决跨域问题
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowCredentials(true)
                .allowedMethods("GET","POST","PUT","DELETE","HEAD","OPTIONS","TRACE","CONNECT")
                .allowedHeaders("*");
    }

//    //配置拦截器
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//
//        registry.addInterceptor(new MyInterceptor())
//                .excludePathPatterns("/webjars/**","/swagger-resources/**","/doc.html")  //  不用拦截的路径
//                .addPathPatterns("/**");   // 拦截所有路径
//    }
}
